import random

import numpy as np
# # 使用numpy生成数组,得到ndarray类型的数组
# t1 = np.array([1,2,3])
# print(t1)
# print(type(t1))
#
# t2=np.array(range(10))
# print(t2)
# print(type(t2))
#
# t3 = np.arange(4,11,2)
# print(t3)
# print(type(t3))
#
# print(t3.dtype)
# print('*'*100)
# # numpy中的数据类型
#
# t4=np.array(range(1,4),dtype='i1')
# print(t4)
# print(t4.dtype)
#
# # numpy中的数据类型
# t5=np.array([1,1,0,1,0,0],dtype=bool)
# print(t5)
# print(t5.dtype)
#
# # 调整数据类型
# t6=t5.astype('int8')
# print(t6)
# print(t6.dtype)
#
# # numpy中的小数
# t7 = np.array([random.random() for i in range(10)])
# print(t7)
# print(t7.dtype)
#
# t8=np.round(t7,2)
# print(t8)

# # shape
# t1=np.arange(12)
# print(t1)
# print(t1.shape)
#
# t2=np.array([[1,2,3],[4,5,6]])
# print(t2)
# print(t2.shape)
#
# t3=np.array([[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]]])
# print(t3)
# print(t3.shape) # shape中有几个数就是几维
#
# t4=np.arange(12)
# print(t4)
#
# t5=t4.reshape(3,4)
# print(t5)
#
# t6=np.arange(24).reshape(2,3,4)
# print(t6)
#
# print(t6.reshape(4,6))
#
# t6=t6.reshape(4,6)
# print(t6)
#
# print(t6.reshape((24,)))
# print(t6.reshape(24,1))
# print(t6.reshape(1,24))
#
# print(t6)
# print(t6.reshape(t6.shape[0]*t6.shape[1],))
# print(t6.flatten())
#
# # 数组和数字进行计算
# print(t6+2)
# print(t6*2)
# print(t6/2)
# # print(t6/0)
#
# # 数组和数组计算
# t7=np.arange(100,124).reshape(4,6)
# print(t6+t7)
# print(t6*t7)
# print(t6/t7)
#
# t8=np.arange(0,6)
# print(t8)
# print(t6-t8)
#
# t9=np.arange(0,4).reshape(4,1)
# print(t9)
# print(t6-t9)
# print('*'*100)
# t10=np.arange(18).reshape(3,3,2)
# print(t10)
# t11=np.arange(9).reshape(3,3)
# print(t11)
# print(t10+t11)



